package com.tledu.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

public class IO07 {
    public static void main(String[] args) {
        // 转化流。
        // 接受一个字节流
        String fileName = "C:\\Users\\cyrus\\Desktop\\大数据17期\\study-java\\src\\com\\tledu\\io\\test";
        InputStreamReader in = null;
        try {
            in = new InputStreamReader(
                    new FileInputStream(fileName)
            );
            while (true) {
                char[] chars = new char[50];
                int num = in.read(chars);
                if (num == -1) {
                    break;
                }
                System.out.print(new String(chars,0,num));
            }

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
